<template>
	<view class="content">
		<view class="integral-top">
			<view class="integral-top-t">
				总积分
			</view>
			<view class="integral-top-n">
				{{integral}}
			</view>
		</view>
		<view class="inte-text">
			<text style="font-size: 12px;color: #969993;">积分明细</text>
		</view>
		<view class="integral-bottom">
			<view class='cell-group margin-cell-group'>
			
			<view  class='cell-item add-title-item jf-list-item' v-for="(item,index) in weetlist" :key="index">
				<view class='cell-item-bd'>
					<view class="cell-bd-view black-text">
						<text class="cell-bd-text" style="font-size: 15px;color: #30362A;font-weight: bold;">{{item.info}}</text>
					</view>
					<view class="cell-bd-view">
						<text class="cell-ft-p" style="color: red;font-size: 18px;" v-if="item.act==1">+{{item.num}}</text>
						<text class="cell-ft-p" style="color: #333333;font-size: 18px;" v-else>-{{item.num}}</text>
					</view>
				</view>
				<view class='cell-item-bd'>		
					<text class="cell-bd-text" style="color: #969993;">{{item.create_time}}</text>
				</view>
			</view>
			
				
				<uni-load-more
				:status="loadStatus"
				:show-icon="true"
				></uni-load-more>
			</view>
		</view>
	</view>
</template>

<script>
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'	
export default {
	data () {
		return {
			page: 1,
			limit: 10,
			weetlist: [], // 积分记录
			loadStatus: 'more',
			integral:0
		}
	},
	components: { uniLoadMore },
	onLoad (options) {
		this.integral = options.integral;
		this.gettWeetList()
	},

	methods: {
	gettWeetList(type) {
		this.loadStatus = 'loading'
		const params = {
			page: this.page
		}
		this.$http.get('/user/integralLog', {
					params: params
				}).then((response) => {
			const res = response.data;
			console.log(res)
			if (res.code==0) {
				if (this.page > res.data.last_page) {
					// 没有数据了
					this.loadStatus = 'noMore'
				} else {
					// 未加载完毕
					this.loadStatus = 'more'
					this.page ++
				}
				console.log(type)
				if(type){
					this.weetlist = res.data.data
				}else{
					this.weetlist = [...this.weetlist, ...res.data.data];
				}
				this.filter = false
			} else {
			   this.filter = false
			}
		})
	}
	},
	// 页面滚动到底部触发事件
	onReachBottom () {
		let _this = this
		if (_this.loadStatus === 'more') {
			_this.gettWeetList()
		}
	}
}	
</script>

<style lang="scss" scoped>
.jf-list-item {
	display: flex;
	flex-direction: column;
	justify-content: initial;
	align-items: initial;
	.cell-item-bd {
		display: flex;
		justify-content: space-between;
		padding-right: 10rpx;
	}
}
.content{
	background-color: #fff;
	padding-top: 20upx;
}
.integral-top{
	    text-align: center;
	    color: #fff;
	    padding: 20px 18px;
	    text-align: left;
		background-color: #FF5F49;
}
.integral-top-t{
	font-size: 28upx;
	margin-bottom: 16upx;
}
.integral-top-n{
	font-size: 58upx;
	margin-bottom: 16upx;
}
.integral-top-d{
	font-size: 22upx;
	color: #999;
}
.cell-title .cell-bd-text{
	font-size: 34upx !important;
}
.cell-bd-view{
	font-size: 22upx;
	color: #999;
}
.cell-item .black-text .cell-bd-text{
	font-size: 28upx;
	color: #333;
}
.inte-text{
	height: 32px;
	background-color: #F9F9F9;
	line-height: 32px;
	text-align: center;
}
</style>
